package com.vavr.checkincms.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.vavr.checkincms.common.domain.BaseResult;
import com.vavr.checkincms.common.domain.ResultEnum;
import com.vavr.checkincms.domain.bo.SystemUserInfoBO;
import com.vavr.checkincms.service.SystemUserService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * 添加修改用户信息
 *
 * @since 2024.12
 */
public class SystemUserController {
    /**
     * systemLoginService
     */
    private final SystemUserService systemUserService;

    public SystemUserController(SystemUserService systemUserService) {
        this.systemUserService = systemUserService;
    }

    /**
     * 新增本地用户
     *
     * @return 新增结果
     */
    @PostMapping("/addUser")
    public BaseResult<String> addUser(@RequestBody SystemUserInfoBO bo) {
        return BaseResult.of(ResultEnum.OK, systemUserService.addUser(bo));
    }

    /**
     * 更新本地用户
     *
     * @return 新增结果
     */
    @PostMapping("/updateUser")
    public BaseResult<String> updateUser(@RequestBody SystemUserInfoBO bo) {
        return BaseResult.of(ResultEnum.OK, systemUserService.updateUser(bo));
    }
}
